package com.wdl.sm.webui.yang.node;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.nokia.taiji.yang.schema.SchemaDataNode;
import com.wdl.sm.webui.yang.YANGExt;

public abstract class NormalizedNode {
    protected static final Logger LOG = LoggerFactory.getLogger("NormalizedNode");

    // the identifier for the schema node
    String id;

    // the absolute path
    String sni;

   // the label of the node if available
    String name;
    
    String description;
    
    // list, leaf, container, leaf-list
    String type;

    // in which module this node belongs to
    String module; 

    String nameSpace;
    boolean mandatory;

    boolean config = true;

    public NormalizedNode(SchemaDataNode node) {
        id = node.getID();
        module = node.getMainModule().getName();
        nameSpace = node.getMainModule().getNamespace();
        mandatory = node.isMandatory();
        config = node.isConfigData();
        type = node.getKeyWord().toString();
        description = node.getDescription();
        sni = node.getSNI().toString();
        name = YANGExt.getExtension(node, "label");
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public boolean isMandatory() {
        return mandatory;
    }

    public void setMandatory(boolean mandatory) {
        this.mandatory = mandatory;
    }

    public boolean isConfig() {
        return config;
    }

    public String getSni() {
        return sni;
    }

    public void setSni(String sni) {
        this.sni = sni;
    }

    public String getNameSpace() {
        return nameSpace;
    }

    public void setNameSpace(String nameSpace) {
        this.nameSpace = nameSpace;
    }
}
